#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;
using i64 = long long;
typedef pair<int, int> PII;
const int N = 30;
int a[N];
void solve()
{
	int n;
	cin >> n;
	vector<PII> ans;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		while (i > 1 && a[i] < a[i - 1])
		{
			a[i] += a[i - 1];
			ans.push_back({ i, i - 1 });
		}
	}
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++)
		cout << ans[i].first << ' ' << ans[i].second << endl;
}
int main()
{
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}